package com.msb.tank.net;

import io.netty.bootstrap.Bootstrap;
import io.netty.channel.*;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.SocketChannel;


public class Client {
    public static final Client INSTANCE = new Client();
    private Channel channel = null;

    private Client() {
    }

    public void connect() {
//        EventLoopGroup group = new NioEventLoopGroup(1);
//        Bootstrap b = new Bootstrap();
//        try {
////            b.group(group).channel(NioSocketChannel.class).handler(new ClientChannelIni)
//        } catch (Exception e) {
//            e.printStackTrace();
//        }
    }
}

//class ClientChannelInitializer extends ChannelInitializer<SocketChannel> {
//    @Override
//    protected void initChannel(SocketChannel ch) throws Exception {
//        ch.pipeline()
//                .addLast(new MsgEncoder())
//                .addLast(new MsgDecoder())
//                .addLast(new ClientHandler());
//    }
//}
//
//class ClientHandler extends SimpleChannelInboundHandler<Msg> {
//    @Override
//    public void channelRead0(ChannelHandlerContext ctx, Msg msg) throws Exception {
//        System.out.println(msg);
//        msg.handle();
//    }
//
//    @Override
//    public void channelActive(ChannelHandlerContext ctx) throws Exception {
////        ctx.writeAndFlush(new TankJoinMsg(TankFrame.INSTANCE.getMainTank()));
//    }
//}